<template>
  <div>
    <div class="top pl20 pr20 s-d-flex">
      <div class="flex-1 mr23">
        <div
          class="img img01 pt37 pl25"
          @click="handleGoTo(userInfo.type == 'admin' ? '/medicalWasteAdmin/retrospect':'/medicalWaste/retrospect')"
        >
          <div class="title fz20">
            医废总量(kg)
          </div>
          <div class="num fz32 pt21 ff">
            {{dataForm.weightSum?dataForm.weightSum:0}}
          </div>
        </div>
      </div>
      <div class="flex-1 mr23">
        <div
          class="img img02 pt37 pl25"
          @click="handleGoTo('/alarmInfo/alarmRecord')"
        >
          <div class="title fz20 ">预警总数</div>
          <div class="num fz32 pt21 ff">{{dataForm.warnCount ? dataForm.warnCount : 0}}</div>
        </div>
      </div>
      <div
        class="flex-1 mr23"
        v-if="userInfo.type == 'admin'"
      >
        <div
          class="img img05 pt37 pl25"
          @click="handleGoTo1('/hospitalInstitutions/index')"
        >
          <div class="title fz20 ">医院数量</div>
          <div class="num fz32 pt21 ff">{{dataForm.hospitalCount ? dataForm.hospitalCount : 0}}</div>
        </div>
      </div>
      <div class="flex-1 mr23">
        <div
          class="img img03 pt37 pl25"
          @click="handleGoTo('/basicData/personnel')"
        >
          <div class="title fz20">转运人员</div>
          <div class="num fz32 pt21 ff">{{dataForm.collectStaffCount ? dataForm.collectStaffCount : 0}}</div>
        </div>
      </div>
      <div class="flex-1">
        <div
          class="img img04 pt37 pl25"
          @click="handleGoTo('/basicData/personnel')"
        >
          <div class="title fz20">医护人员</div>
          <div class="num fz32 pt21 ff">{{dataForm.handStaffCount ? dataForm.handStaffCount : 0}}</div>
        </div>
      </div>

    </div>
  </div>
</template>
<script>
import * as statisticsApi from "@/api/statistics";
import { getUserInfo, setUserInfo } from "@/utils/auth";
export default {
  data() {
    return {
      dataForm: {},
      userInfo: {},
    };
  },
  mounted() {
    this.userInfo = getUserInfo() ? JSON.parse(getUserInfo()) : {};
    this.handleInit();
  },
  methods: {
    handleGoTo(_row) {
      if (this.userInfo.type == "admin") {
        if (
          _row == "/medicalWasteAdmin/retrospect" ||
          _row == "/medicalWaste/retrospect"
        ) {
          this.$router.push({
            path: _row,
          });
        }
        return;
      }
      this.$router.push({
        path: _row,
      });
    },
    handleGoTo1(_row) {
      this.$router.push({
        path: _row,
      });
    },
    handleInit() {
      statisticsApi.wasteBaseSituation().then((res) => {
        if (res && res.success) {
          this.dataForm = res.data;
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.img {
  height: 180px;
  color: #fff;
}
.img01 {
  background: url("../../../assets/img01.png") no-repeat center center;
  background-size: 100% 100%;
}
.img02 {
  background: url("../../../assets/img02.png") no-repeat center center;
  background-size: 100% 100%;
}
.img03 {
  background: url("../../../assets/img03.png") no-repeat center center;
  background-size: 100% 100%;
}
.img04 {
  background: url("../../../assets/img04.png") no-repeat center center;
  background-size: 100% 100%;
}
.img05 {
  background: url("../../../assets/img05.png") no-repeat center center;
  background-size: 100% 100%;
}
</style>